{% extends "base.html" %}

{% block header %}
	{% if submitter_email %}
			{{ block.super }} 
			<h2>{{ submitter_email }}</h2>
	{% else %}
			{{ block.super }} 
			<h2>All Tickets</h2>
	{% endif %}
{% endblock %}

{% block menu %}
{% if not submitter_email %}
	<a class='nav' title='Open Tickets' href='{% url public_ticket_list_status t_status=1 %}'>
		<span class='button'>Open</span>
	</a>
	<a class='nav' title='On-Hold Tickets' href='{% url public_ticket_list_status t_status=2 %}'>
		<span class='button'>On-Hold</span>
	</a>
	<a class='nav' title='Resolved Tickets' href='{% url public_ticket_list_status t_status=3 %}'>
		<span class='button'>Resolved</span>
	</a>
	<a class='nav' title='Closed Tickets' href='{% url public_ticket_list_status t_status=4 %}'>
		<span class='button'>Closed</span>
	</a>
	<a class='nav' title='Re-Opened Tickets' href='{% url public_ticket_list_status t_status=5 %}'>
		<span class='button'>Re-Opened</span>
	</a>
{% endif %}
{% endblock %}

{% block body %}

<div id='ticket-list'>
{% for ticket in tickets %}
	{% ifchanged ticket.status %}
		<div class='status-header'>{{ ticket.get_status_display }}</div>
	{% endifchanged %}
	<div class='ticket-row' onclick="location.href='{% url public_ticket_detail ticket_id=ticket.id %}';">
		<div class='ticket-status'>
			<h1>Status:</h1>
			{{ ticket.get_status_display }}
			<h1>Priority:</h1>
			{{ ticket.get_priority_display }}
			<h1>Notes:</h1>
			{{ ticket.note_set.count }}
		</div>
		<span class='ticket-title'><a href="{% url public_ticket_detail ticket_id=ticket.id %}">{{ ticket.title }}</a></span> &nbsp;-&nbsp; 
		<span class='ticket-submitter'>{{ ticket.submitter_email }}</span><br />
		<span class='ticket-desc'>{{ ticket.description|truncatewords:"50" }}</span>
	</div>
{% empty %}
	No Tickets in the system
{% endfor %}
</div>

{% endblock %}
